<?php session_start();?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<?php
if(isset($_SESSION['lang']))
    require_once "./language_files/sorting_" . $_SESSION['lang'] . ".php";
else
    require_once "./language_files/sorting_en.php";

require_once "functions.php";
?>
<html> 
    <head>
        <link href="style3.css" rel="stylesheet" type="text/css" />


    </form>
</head> 
</html>
<?php
//open the connection in the DB

if(isset($_GET['submit']))
{
    $query=mysql_query("SELECT * FROM conference ORDER BY long_name") or die('here' . mysql_error());
    // Query to sort the conferences alphabatically by name.
    //table containing all the conferences available
    echo '<table width="100%">
    <tr>
    <td><b>' . $lang['conf'] . '</b>
    </td>
    </tr>';

//redirect to the conference page 
    while($row=mysql_fetch_assoc($query))
    {
        $long=formatText_safe($row['long_name']);
        echo "<tr>
	  <td>{$long}</td> 
	  <td><a href='conferencePage.php?conference_id={$row['conference_id']}'>" . $lang['goConf'] . "</a </td> 
	  </tr>";
    }

    echo '</table>';
}
else if(isset($_GET['submit2']))
{
    $date=mysql_query("SELECT * FROM conference ORDER BY rev_startDate") or die('here' . mysql_error());
    //Query to sort the conferences by the date.
    //table containing all the conferences available
    echo '<table width="100%">
    <tr>
    <td><b>' . $lang['conf'] . '</b>
    </td>
    </tr>';

//redirect to the conference page 
    while($row=mysql_fetch_assoc($date))
    {
        $long=formatText_safe($row['long_name']);
        echo "<tr>
	  <td>{$long}</td> 
	  <td><a href='conferencePage.php?conference_id={$row['conference_id']}'>" . $lang['goConf'] . "</a </td> 
	  </tr>";
    }

    echo '</table>';
}
?>
</body>
</html>

